/* eslint-disable*/

import React from 'react';
import { Button } from 'antd';
import './index.less';
import _ from 'lodash';

export default (props: any) => {
  const {
    text = '',
    onClick,
    disabled = false,
    type,
    XIcon,
    ...otherProps
  } = props;
  return (
    <Button
      className={'X-button'}
      type={type || 'primary'}
      onClick={!disabled && onClick ? _.debounce(onClick, 500) : () => {}}
      disabled={disabled}
      {...otherProps}
    >
      {XIcon ? (
        <div className={'X-button-icon'}>
          <XIcon />
          {text}
        </div>
      ) : (
        text
      )}
    </Button>
  );
};